package com.cloudfun.campusshare.common.model.dto;

import com.cloudfun.campusshare.common.constant.miniprogram.WeChatReturnCode;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlCData;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import lombok.Data;

/**
 * Created by Huqin on 2020/4/20
 */
@Data
@JacksonXmlRootElement(localName = "xml")
public class WeChatNotifyRespDTO {

    @JacksonXmlProperty(localName = "return_code")
    @JacksonXmlCData
    private WeChatReturnCode returnCode;

    @JacksonXmlProperty(localName = "return_msg")
    @JacksonXmlCData
    private String returnMsg;

    public static WeChatNotifyRespDTO success() {
        WeChatNotifyRespDTO respDTO = new WeChatNotifyRespDTO();
        respDTO.setReturnCode(WeChatReturnCode.SUCCESS);
        respDTO.setReturnMsg("OK");
        return respDTO;
    }

    public static WeChatNotifyRespDTO fail(String msg) {
        WeChatNotifyRespDTO respDTO = new WeChatNotifyRespDTO();
        respDTO.setReturnCode(WeChatReturnCode.FAIL);
        respDTO.setReturnMsg(msg);
        return respDTO;
    }

}
